Hi,
Generally speaking reading the file seems ok, there is a number of things
that could use fixing but that can be discussed in a PR (e.g, no need for
the absolute path, there are utilities to get a file extension, no need for
the line number reader, exception eaten).

I'd go ahead with a PR containing a test

Cheers
Andrea

Il mer 13 mar 2019, 20:03 Burkhard Strauss <servi...@strauss.eng.br> ha
scritto:

> Fine, I am happy you're interested. So I will make one change at a time. I
> will start with the *.cpg file. The change will concern the
> DataStoreFactory and look like this (the green part is the addition):
>
> public DataStore createDataStore(Map<String, Serializable> params) throws
> IOException {
>
>         // ...
>
>         Charset dbfCharset = lookup(DBFCHARSET, params, Charset.class);
>         {
>             final File file = URLs.urlToFile(url);
>             if (file != null) {
>                 String fileName = file.getAbsolutePath();
>                 final int k = fileName.lastIndexOf('.');
>                 if (k >= 0) {
>                     fileName = fileName.substring(0, k) + ".cpg";
>                     try (FileReader reader = new FileReader(fileName);
>                             LineNumberReader lr = new
> LineNumberReader(reader)) {
>                         final String charsetName = lr.readLine().trim();
>                         dbfCharset = Charset.forName(charsetName);
>                     } catch (final Exception e) {
>                     }
>                 }
>             }
>         }
>
>         // ...
>
>         store.setCharset(dbfCharset);
>
>         // ...
>     }
>
> Regards
> Burkhard
>
>
>
> Am 12.03.2019 um 15:41 schrieb Andrea Aime:
>
> Hi,
> improvements are often welcomed, but it's hard to tell unless you explain
> a bit how they are meant to be implemented,
> the "talk first" policy implies that one discusses the plan before
> implementation, or be ready to amend/start over in case the
> discussion brings the desired implementation in a different direction.
>
> Changes that are typically not  welcomed are those breaking backwards
> compatibility (but there are often ways to handle that, like deprecation
> cycles and the like)
> or cause functional or performance regressions in existing use case.
>
> On Tue, Mar 12, 2019 at 2:47 PM Burkhard Strauss <servi...@strauss.eng.br>
> wrote:
>
>>
>>    - some data providers provide  gzipped shapefiles (not
>>    *.shp/*.shx/*.dbf/*.prj but *.shp.gz/*.shx.gz/*.dbf.gz/*.prj.gz)
>>    Example: TomTom street map data. Support reading of such data.
>>    - some data providers provide an additional *.cpg-file containing the
>>    character set name for string-fields in the *.dbf-file. Example:
>>    HERE/NavStreets street map data. Support reading of such data.
>>    - some data providers provide data without geometries, i.e. only  *.dbf
>>    without *.shp. Example: HERE/NavStreets street map data. Support
>>    reading of such data.
>>    - force usage of the SRID provided in the parameters when reading
>>    input
>>
>> Are there chances that I'll be allowed to incorporate these features into
>> org.geotools.data.shapefile?
>>
> All seem interesting. I would suggest you start making either PRs for one
> of them at a time, or describing the code changes required,
> again, one at a time.
> Also, be patient, our ability to follow up on mail is limited by work,
> family and other activities, it would not be strange if the turnaround
> for mails or PRs takes several hours if not days.
>
> Cheers
> Andrea
> ==
>
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf
> Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa
> (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
> http://www.geo-solutions.it http://twitter.com/geosolutions_it
> ------------------------------------------------------- *Con riferimento
> alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 -
> Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni
> circostanza inerente alla presente email (il suo contenuto, gli eventuali
> allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i
> destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per
> errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
> sarei comunque grato se potesse darmene notizia. This email is intended
> only for the person or entity to which it is addressed and may contain
> information that is privileged, confidential or otherwise protected from
> disclosure. We remind that - as provided by European Regulation 2016/679
> “GDPR” - copying, dissemination or use of this e-mail or the information
> herein by anyone other than the intended recipient is prohibited. If you
> have received this email by mistake, please notify us immediately by
> telephone or e-mail.*
>
>
>
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to